#include <QThread>
#include <QMutex>
#include "MvCameraControl.h"
#include <opencv2/opencv.hpp>
class ImageCaptureThread : public QThread
{
    Q_OBJECT
public:
    explicit ImageCaptureThread(void* cameraHandle, QObject *parent = nullptr);
    ~ImageCaptureThread();

    void stopCapture(); // 停止采集

signals:
    // 发送图像数据给主线程
    void imageCaptured(const QImage& image);
    void errorOccurred(const QString& errorMsg);

protected:
    void run() override;

private:
    void* m_hDevHandle; // 相机句柄
    QMutex m_mutex;
    bool m_isRunning; // 控制线程运行的标志
    unsigned int m_nBufSizeForSaveImage;
    cv::Mat *imagePtr = NULL;
};
